{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fc586ef2",
   "metadata": {},
   "outputs": [],
   "source": [
    "good_list = [\n",
    "    #商品的样式： [商品名称，商品价格]\n",
    "    ['水'，3]\n",
    "    ['奶茶'，5]\n",
    "    ['可乐'，10]\n",
    "    ['酸奶'，15]\n",
    "]\n",
    "#写到某一步，发现前面需要内容。可以优化增加\n",
    "user_shopping_cart = []#用户列表初始为空，后续用append。进行增加\n",
    "\n",
    "#用户输入：input\n",
    "Alipay = input（'请输入您的余额：'）\n",
    "\n",
    "#打印商品信息  打印商品的次数是由商品列表的长度决定的（len(goods_list)）\n",
    "while True: #将实现 过程 的循环\n",
    "    print（'------商品列表信息------'）\n",
    "for i in range(len(goods_list)):\n",
    "    #给格式化的样式（先给）\n",
    "    #样式（不懂代码的人可以完成的工作）\n",
    "    # ：'商品编号：xx,商品名称：xx,商品价格：xx'\n",
    "    print（'商品编号：xx，商品的名称：%s,商品的价格：%s 元'%（i,goods_list[i][0],goods_list[i]）\n",
    "    \n",
    "#2.让用户输入商品编号进行购买\n",
    "#用户输入商品编号\n",
    "choice = input('请输入正确的商品编号进行购买：')\n",
    "#判断商品编号是否在我们的范围内\n",
    "if choice.isdight():#isdight 判断字符串是否是数值\n",
    "    choice = int(choice) #如果说数值把它变成真正的int\n",
    "    #判断商品编号是否在 我们的范围内\n",
    "    if choice >= len(good list):  \n",
    "    if Alipay > goods_list[]\n",
    "    choice = int(choice)\n",
    "    if choice > len#        yh\n",
    "    elif choice =='q':\n",
    "        #如果\n",
    "        查看                                   \n",
    "        break\n",
    "        "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
